﻿using System.ComponentModel;
using Aierp.Utility.Data;

namespace Aierp.SystemEntities.System 
{
    [TableName("Sys_Departments")]
    [Description("部门管理")]
    public class Sys_Departments
    {
        [DefaultValue(0)]
        public int KeyId { get; set; }

        [Description("部门名称")]
        public string DepartmentName { get; set; }
        /// <summary>
        /// 单位编码
        /// </summary>
        public string DepCode { get; set; }

        /// <summary>
        /// 单位类型
        /// </summary>
        public int DepType { get; set; }
        
        /// <summary>
        /// 法人
        /// </summary>
        public string Faren { get; set; }
        /// <summary>
        /// 联系电话
        /// </summary>
        public string Tel { get; set; }

        /// <summary>
        /// 所在区域
        /// </summary>
        public int AreaId { get; set; }

        [DbField(false)]
        //public string AreaTitle
        //{
        //    get { return AreaDal.Instance.Get(AreaId).Title; }
        //}

        /// <summary>
        /// 是否可用 0不用 1可用
        /// </summary>
        public int IsUse { get; set; }

        /// <summary>
        /// 单位地址
        /// </summary>
        public string Addr { get; set; }

        /// <summary>
        /// 上级单位
        /// </summary>
        [DefaultValue(0)]
        [Description("上级ID")]
        public int ParentId { get; set; }

        [DefaultValue(0)]
        [Description("排序")]
        public int Sortnum { get; set; }

        [Description("备注")]
        public string Remark { get; set; }

        [DbField(false)]
        //public IEnumerable<Department> children
        //{
        //    get { return DepartmentDal.Instance.GetChildren(KeyId); }
        //}

        /// <summary>
        /// tree 节点状态
        /// </summary>
        //[DbField(false)]
        //public string state
        //{
        //    get
        //    {
        //        if (ParentId == 0)
        //            return "open";
        //        return children.Any() ? "closed" : "open";
        //    }
        //}

        [DefaultValue("")]
        [Description("值班报警电话")]
        public string OndutyPhone { get; set; }

        [DefaultValue("")]
        [Description("值班主管报警电话")]
        public string OndutyPhone2 { get; set; }

        [Description("咨询投诉电话")]
        public string ComplainPhone { get; set; }

        [Description("公司网站")]
        public string WebSite { get; set; }

        [Description("企业QQ")]
        public string QQ { get; set; }

    }
}
